/*
 * @Author: hc
 * @Date: 2024-03-05 19:36:52
 * @LastEditTime: 2024-03-05 20:55:45
 * @LastEditors: hc
 * @Description: 工具类
 */
export const getCursorPosition = (ctrl) => {
  let CaretPos = {
    start: 0,
    end: 0
  };
  if (ctrl?.resizableTextArea?.textArea.selectionStart) {
    CaretPos.start = ctrl?.resizableTextArea?.textArea.selectionStart;
  }
  if (ctrl?.resizableTextArea?.textArea.selectionEnd) {
    CaretPos.end = ctrl?.resizableTextArea?.textArea.selectionEnd;
  }
  return CaretPos;
};

export const setCursorPosition = (ctrl, start, end) => {
  ctrl.focus();
  ctrl.resizableTextArea.textArea.setSelectionRange(start, end);
};
